<!--
@name:dialogPointList
@author:Zhenglei
@date:14:55
@description:dialogPointList
@update:2022/8/1614:55
-->
<template>
  <el-dialog title="指征列表"
             :visible.sync="visible"
             :before-close="modalClose"
             :append-to-body="true"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
             width="50%">
    <element-table
      class="mt-20"
      :columns="columns"
      :data="tableData"
      v-loading="loading">

      <template v-slot:option="{row,index}">
        <el-button type="primary"
                   @click="handleConfig(row)">推送配置
        </el-button>
      </template>
    </element-table>
    <dialog-config v-if="showConfigDialog" :visible.sync="showConfigDialog" :pointConfigData="pointConfigData"/>
  </el-dialog>
</template>

<script>
  import ElementTable from "../../../../base/ElementTable";
  import dialogPointConfig from "./dialogPointConfig";

  export default {
    name: "dialogPointList",
    props: {
      dataObj: {
        type: Object,
        default: {}
      },
      visible: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        loading: false,
        showConfigDialog: false,
        tableData: [],
        pointConfigData: {},
        columns: [
          {
            label: '指征名称',
            prop: 'indicationName',
            align: 'center'
          }, {
            label: '操作',
            prop: 'option',
            align: 'center',
            isSlot: true
          }
        ]

      }
    },
    created() {
      this.getDiscLifeIndications()
    },
    methods: {
      modalClose() {
        this.$emit('update:visible', false);
      },
      //查询指征
      getDiscLifeIndications() {
        this.loading = true
        this.post(this.api.healthMap.getDolConstantIndicationsList, {
          id: this.dataObj.id
        }).then(res => {
          this.loading = false
          if (res.data.code === '200') {
            this.tableData = res.data.object;
          }
        })
      },
      handleConfig(row) {
        this.pointConfigData = row
        this.$set(this.pointConfigData, 'themeId', this.dataObj.themeId)
        this.showConfigDialog = true
      }
    },
    components: {
      'element-table': ElementTable,
      'dialog-config': dialogPointConfig
    }
  }
</script>

<style scoped>

</style>
